<?php
html::printPath(array('bankAccount.form-title' => 'org/myBankAccount/all', 'application.page-title-display' => ''));
$msg->printMessages();

echo '<ul class="commandList">';
if (! $bankAccountIsUsed) {
    echo '<li class="editLi">' . html::anchor('org/myBankAccount/edit?id=' . $bankAccount['id'], text::get('bankAccount.editThis')) . '</li>';
    echo '<li class="deleteLi">' . html::anchor('org/myBankAccount/delete?id=' . $bankAccount['id'], text::get('bankAccount.deleteThis'), array('onclick'=>'return confirmDeletion()')) . '</li>';
}
if ($bankAccount['enabled']) {
    echo '<li class="disableAction">' . html::anchor('org/myBankAccount/disable?id=' . $bankAccount['id'], text::get('bankAccount.disableThis')) . '</li>';
}
else {
    echo '<li class="enableAction">' . html::anchor('org/myBankAccount/enable?id=' . $bankAccount['id'], text::get('bankAccount.enableThis')) . '</li>';
}
echo '</ul>';

if ($bankAccountIsUsed) {
    echo '<p class="warningNote">' . text::getEscaped('bankAccount-error-cannotBeEdited') . '</p>';
}

$fb = new FormBuilder('bankAccount', $bankAccount);
$fb->displayOnly();
$fb->text('name')->identifyingValue();
$fb->text('bank_name');
$fb->text('number');
$fb->text('iban');
$fb->text('swift');
$fb->yesNoBox('enabled');
$fb->write();

if ($seminarList) {
    echo '<h2>' . text::getEscaped('bankAccount.seminarsPaidToThisAccount') . '</h2>';

    $elb = new EntityListBuilder('seminar', $seminarList);
    $elb->setUuid($this->DISPLAY_SEMINAR_LIST_UUID);
    $elb->text('name')->linkWithValue('/org/myBankAccount/displaySeminar?id=', 'id')->openInPopup();
    $elb->date('begin_date');
    $elb->date('end_date');
    $elb->boolean('active');
    $elb->write();
}

if ($viSeminarList) {
    echo '<h2>' . text::getEscaped('bankAccount.viSeminarsPaidToThisAccount') . '</h2>';

    $elb = new EntityListBuilder('viSeminar', $viSeminarList);
    $elb->setUuid($this->DISPLAY_VISEMINAR_LIST_UUID);
    $elb->text('name')->noLink();
    $elb->date('begin_date');
    $elb->date('end_date');
    $elb->boolean('active');
    $elb->write();
}